package com.woniuxy.reader.mapper;

import com.woniuxy.reader.entity.Subscribe;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.reader.vo.SubscribeVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zh_o
 * @since 2020-10-12
 */
public interface SubscribeMapper extends BaseMapper<Subscribe> {

    @Select("select s.subscribe_time,s.amount,c.chapter_name,b.book_name from subscribe s LEFT JOIN chapter c ON s.chapter_id=c.chapter_id LEFT JOIN book b ON c.book_id=b.book_id where user_id=#{userid}")
    List<SubscribeVO> selectSubscribeByUserId(String userid);
}
